package com.vietnam.power.persitence;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the user_role_info database table.
 * 
 */
@Entity
@Table(name="user_role_info")
public class UserRoleInfo implements Serializable {
	private static final long serialVersionUID = 1L;
	private int id;
	private String roleName;
	private List<MenuAccessRight> menuAccessRights;
	private List<UserRole> userRoles;

	public UserRoleInfo() {
	}

	public UserRoleInfo(int id) {
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}


	@Column(name="role_name")
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}


	//bi-directional many-to-one association to MenuAccessRight
	@OneToMany(mappedBy="userRoleInfo")
	public List<MenuAccessRight> getMenuAccessRights() {
		return this.menuAccessRights;
	}

	public void setMenuAccessRights(List<MenuAccessRight> menuAccessRights) {
		this.menuAccessRights = menuAccessRights;
	}

	public MenuAccessRight addMenuAccessRight(MenuAccessRight menuAccessRight) {
		getMenuAccessRights().add(menuAccessRight);
		menuAccessRight.setUserRoleInfo(this);

		return menuAccessRight;
	}

	public MenuAccessRight removeMenuAccessRight(MenuAccessRight menuAccessRight) {
		getMenuAccessRights().remove(menuAccessRight);
		menuAccessRight.setUserRoleInfo(null);

		return menuAccessRight;
	}


	//bi-directional many-to-one association to UserRole
	@OneToMany(mappedBy="userRoleInfo")
	public List<UserRole> getUserRoles() {
		return this.userRoles;
	}

	public void setUserRoles(List<UserRole> userRoles) {
		this.userRoles = userRoles;
	}

	public UserRole addUserRole(UserRole userRole) {
		getUserRoles().add(userRole);
		userRole.setUserRoleInfo(this);

		return userRole;
	}

	public UserRole removeUserRole(UserRole userRole) {
		getUserRoles().remove(userRole);
		userRole.setUserRoleInfo(null);

		return userRole;
	}

}